package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;



/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016100100637915";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCgnc2vSVq5vlHKGq/iZecE7k6FNR7WJg3ZppxdpEEtcHQliBaJ6RbM12D1Bl3GIpMWVDO4vPHg5ZHus48E4d1KPuaY2+AlHr22pNyjYB5aCd6GBSALB4/ppTi+EbRAxCwVtf56jTIDL2EaL2jGyCm6uMfUng2uba1UCf3v3VAt4iCICyH0VPLKZg4Ay5BcdRF7ToWliR+bK5GIXXulHsFyUmewlPlSapW1hvGjKwjBEXHit37/2pVpdRG8WJ3nMXmEIt+vvK7AEcXoaguyZPHfOGPzhDU5SedBz/B17eGsjvMCU6c+VnHLabErZ30GsrIoeQ1ULFJZ9qiD992r9yX5AgMBAAECggEBAImJl/BaKE6WIwOmBqcgC8u1JZf7/QP0YjfW7F9joEyA13SsLGC8MMIITQaFBRf902ZzhDbV1Wp4K5b0O6w6nXxOkLik0DP5NwuH8UgVruf7O4oYKXBIcXvp98UK9Afh9L5Csj/PWNxRXh1GK7rM/K7gPH5dOen8EUi9pa4ZHeerNq294l7aIj05iEDrqRv7FX1UdOJIPZLoNr+sG2/Pa3IHTYi7wj+ajUlGn7oNq0sIm2qTvADapsW7z8niFbd3kmnuaj/WV8PlXf1xd7KmjrorVjpdBMnBtUHv1U7a5CAUO9GVGZjMafl3wV72TzGzzHamyweY0QsOlkBPMxIYgAECgYEA36DKEM6LFAPc86pgS9C38QpWlqrIza4k1uHvPNmRUFClPQeQjF+DBfDwjrDx9DgkPc1yVr3v0y0J9UzE5GgmuPg39I4AkED0N14u32y1ADqL9RJIJggPepaaFMS3osz95nGt3YVa+GrD6SrPF5NbqSu8eu/1cKpFHWIObK7lVgECgYEAt93tdeJBasQ4Isr15XI1/E+kK+R3jZ1Mdcm04crh8gTe6K4oLONMztjldneLa8l3HlGPksv6H8QyqtfLDNb3cEqEm+BfbZqI8qDJU701536suSduye8JTyEPbyrXyZtlRqK+erlt53y9TnMAxnxpw7ZA2iT9lZSLVEBujaE8f/kCgYEAsH+KG/u4PyLRZ6tn906TbvX241GFzPgN8V8+3+rjytzrnaBz0KatlanVYvl67YLF79VP0fB08VpRyr49g/xD26dlGmpdPX1WgsCeBA8bSEPtJI66TPH9rYZhs9STDzX1isTcMcNHylsRptz3uCbAqGNxjiIHuFVa2VcEBXmAXgECgYA/N6G+h1VgpSh75faXtiYTozpaEQp9+Vhho0F65Ku876nIrKCJlnlBIVf73GxmWfWHyhkoKtPL+kRFcz6QIpUe2bAwe/uzjo+JhHjUPtj6yBYQ7xrreTFlMIPDACMDYVd36tq9DWZZUg0wnN/mXr5qmQ5BMrixpkolZKXeMlK/2QKBgQDRaNVuEr+/q8wZyZ6yuGGtSpRA41LiG1TCI8Zmoyvra4n3Pql9ZDLUd19OtLS8/iV7qoSarxtzZeP7E0acKfvC9dGRnUtlh2AfcTWYKt6Goa7HG+g3eoBey+tr5rvoqvl55zZELPQlH5pTlgCr60VhaDBOAjfZ/cilnxTnRXqEqw==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoJ3Nr0laub5Ryhqv4mXnBO5OhTUe1iYN2aacXaRBLXB0JYgWiekWzNdg9QZdxiKTFlQzuLzx4OWR7rOPBOHdSj7mmNvgJR69tqTco2AeWgnehgUgCweP6aU4vhG0QMQsFbX+eo0yAy9hGi9oxsgpurjH1J4Nrm2tVAn9791QLeIgiAsh9FTyymYOAMuQXHURe06FpYkfmyuRiF17pR7BclJnsJT5UmqVtYbxoysIwRFx4rd+/9qVaXURvFid5zF5hCLfr7yuwBHF6GoLsmTx3zhj84Q1OUnnQc/wde3hrI7zAlOnPlZxy2mxK2d9BrKyKHkNVCxSWfaog/fdq/cl+QIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://192.168.11.239:8085/index.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问

    public static String return_url = "http://192.168.11.239:8085/personal1";


    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";
//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

